home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / gl101.zip / MENUDEMO.PRG < prev    next >
Text File  |  1991-07-18  |  7KB  |  153 lines

  1. //.............................................................................
  2. //
  3. //   Program Name: MENUDEMO.PRG      Copyright: Global Technologies Corporation                          
  4. //   Date Created: 01/17/91           Language: Clipper 5.0                                         
  5. //   Time Created: 23:55:15             Author: Bill French                               
  6. //   /brief/library.src
  7. //.............................................................................
  8. #include "gllibr.ch"                             // include the gl language definitions
  9.  
  10. #define MaxPrompts 10
  11.  
  12. function Main()
  13.    local choice_
  14.    clear screen                                     // clear the text screen
  15.    set graphics on                                  // graphics mode
  16.    set mouse on                                     // turn on the mouse
  17.    set palette background to white                  // change the background color
  18.    set event shadow to "n+/b"                       // clear button gets set shadow color
  19.    clear graphics screen                            // clear the graphics screen
  20.  
  21.    set character set to system medium
  22.  
  23.    do while .t.
  24.       clear graphics screen
  25.       setcolor("w+/b+")                             // set the menu color (std Clipper 5.0 function)
  26.       set character set to system large             // change the character set back to system small
  27.       draw "GL Experimental Menu" at 02,40 center
  28.       choice_ = popupmenu(05,10,3)
  29.       do case                                       // evaluate the mouse click
  30.       case choice_ == "one"                         // if region 1 was clicked
  31.          clear graphics screen                      // clear the graphics screen
  32.          set character set to system small          // change the character set back to system small
  33.          setcolor("w+/b")                           // set the menu color (std Clipper 5.0 function)
  34.          draw bar chart at 18,14 using demo.dbf ;   // display a bar chart
  35.             plot div_income ;                       // select the field to plot
  36.             label div_code ;                        // specify the label
  37.             filter recno()<=16 ;                    // set the filter
  38.             3d ;                                    // display in 3d mode
  39.             height 12 ;
  40.             width 60 ;
  41.             division 5000 ;
  42.             dotted ;
  43.             box
  44.          setcolor("w+/b")                           // set the menu color (std Clipper 5.0 function)
  45.          draw "Sales" at 06,02 using system large vertical
  46.          draw "Division Sales" at 23,17 using roman 3828
  47.          set character set to system large
  48.  
  49.          setcolor("w+/b+")                             // set the menu color (std Clipper 5.0 function)
  50.          draw "Isolate On Division" at 01.8,40.5
  51.          draw box from 02,40 to 04,44 pattern 2 bevel
  52.          @ 03.6,40.90 draw "SW" using system large
  53.          draw box from 02,46 to 04,50 pattern 2 bevel
  54.          @ 03.6,46.90 draw "NW" using system large
  55.          draw box from 02,52 to 04,56 pattern 2 bevel
  56.          @ 03.6,52.90 draw "SE" using system large
  57.          draw box from 02,58 to 04,62 pattern 2 bevel
  58.          @ 03.6,58.90 draw "NE" using system large
  59.  
  60.          popmenu1(01,02,7)
  61.       case choice_ == "two"                         // if region 2 was clicked
  62.          clear graphics screen                      // clear the graphics screen
  63.          set character set to system small          // change the character set back to system small
  64.          set color to "b/w"
  65.          draw pie chart at 09,40 using demo.dbf ;   // draw a pie chart
  66.             plot div_income ;                       // select the field to plot
  67.             label division ;                        // select the lable
  68.             radius 12 ;
  69.             pattern ;                               // select alternating patterns
  70.             explode 3 ;                             // select the first slice to explode
  71.             filter year = "1990" ;                  // only plot 1990 data
  72.             color
  73.          setcolor("w+/b")                           // set the menu color (std Clipper 5.0 function)
  74.          draw "Divisional Sales" at 19,14 using roman 3828
  75.          do pause                                   // prompt for a mouse click
  76.       case choice_ == "quit"                        // if region 3 was clicked
  77.          exit
  78.       endcase                                       // do case                                       // evaluate the mouse click
  79.    enddo                                            && do while .t.
  80.    set mouse off
  81.    set graphics off
  82.    clear screen
  83. return(Void)
  84.  
  85. function popupmenu(x,y,items)
  86.    local temp, prompt, n, _width, _prompts_[items][2]  // declare the menu array
  87.    for prompt := 1 to items
  88.       _prompts_[prompt,1] := NullString          // GL memvar
  89.       _prompts_[prompt,2] := NullString          // GL memvar
  90.    next                                          // for prompt := 1 to maxprompt                  
  91.    _prompts_[1,1] := "Three Dimensional Bar Graph " 
  92.    _prompts_[2,1] := "Pie Chart                   " 
  93.    _prompts_[3,1] := "Quit                        " 
  94.  
  95.    _prompts_[1,2] := "one"
  96.    _prompts_[2,2] := "two"
  97.    _prompts_[3,2] := "quit"
  98.  
  99.    _width := len(_prompts_[1,1]) + 5
  100.    __DrawBevel(x,y,items+1,_width,3)
  101.    set color to "w+/"
  102.    for n := 1 to items
  103.       draw _prompts_[n,1] at x+n+.4,y+1.4
  104.       define event _prompts_[n,2] from x+n-.5,y+1.4 to x+n+.5,y+_width activate
  105.    next                                          // for n := 1 to items
  106.    wait event to temp
  107. return(temp)
  108.  
  109. function popmenu1(x,y,items)
  110.    local _width, j, temp, prompt, _prompts_[items][2]  // declare the menu array
  111.    for prompt := 1 to items
  112.       _prompts_[prompt,1] := NullString          // GL memvar
  113.       _prompts_[prompt,2] := NullString          // GL memvar
  114.    next                                          // for prompt := 1 to maxprompt                  
  115.    _prompts_[1,1] := "Update Database       " 
  116.    _prompts_[2,1] := "What If...            " 
  117.    _prompts_[3,1] := "Show Database Detail  " 
  118.    _prompts_[4,1] := "Show Percentages      " 
  119.    _prompts_[5,1] := "Adjust Graph Scale    " 
  120.    _prompts_[6,1] := "Print To LaserJet III " 
  121.    _prompts_[7,1] := "Return To Main Menu   " 
  122.  
  123.    _prompts_[1,2] := "1"
  124.    _prompts_[2,2] := "2"
  125.    _prompts_[3,2] := "3"
  126.    _prompts_[4,2] := "4"
  127.    _prompts_[5,2] := "5"
  128.    _prompts_[6,2] := "6"
  129.    _prompts_[7,2] := "7"
  130.  
  131.    _width := len(_prompts_[1,1]) + 5
  132.    clear graphics window from x-.15,y-.325 to x+items+1.15,y+_width+.325
  133.    __DrawBevel(x,y,items+1,_width,3)
  134.    set color to "w+/"
  135.    for j := 1 to items
  136.       draw _prompts_[j,1] at x+j+.4,y+1.4
  137.       define event _prompts_[j,2] from x+j-.5,y+1.4 to x+j+.5,y+_width activate
  138.    next                                          // for n := 1 to items
  139.    wait event to temp
  140. return(temp)
  141.  
  142. proc pause
  143.    setcolor("w+/b+")                             // set the menu color (std Clipper 5.0 function)
  144.    draw box from 21,26 to 23,56 pattern 3 bevel
  145.    @ 22.7,27.5 draw "Click here to continue..." using system large
  146.    define event "pause" from 21,26 to 23,56 activate
  147.    wait event "pause" release
  148.    clear graphics window from 21,26 to 23,56 bevel
  149. return
  150.  
  151.  
  152.  
  153.